package com.community.process._1010.dao.view;

import com.community.process._1010.common.utils.SystemAmountUtil;
import com.community.process._1010.dao.entity.ProcessFoodItem;
import com.community.process._1010.dao.vo.ProcessFoodItemIngredientsVo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

/**
 * @Description:
 * @Author: Administrator to Zbs
 * @Date: 2024/9/6 星期五 14:59
 */
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class ProcessFoodItemView {

    @Schema(description = "ID")
    private Long id;

    @Schema(description = "菜品名称")
    private String name;

    @Schema(description = "描述")
    private String description;

    @Schema(description = "菜品图片")
    private String image;

    @Schema(description = "分类ID")
    private Long categoryId;

    @Schema(description = "分类节点ID")
    private List<Long> categoryNodeIds;

    @Schema(description = "成品菜价格 单位：分")
    private BigDecimal price;

    @Schema(description = "上下架 1 上架 0 下架")
    private Integer up;

    @Schema(description = "单位")
    private String units;

    @Schema(description = "重量")
    private Integer weight;

    @Schema(description = "创建时间")
    private LocalDateTime createTime;

    /**
     * 菜品所需要的食材
     */
    @Schema(description = "菜品所需要的食材")
    private List<ProcessFoodItemIngredientsVo> ingredients;

    public ProcessFoodItemView(ProcessFoodItem item,List<Long> categoryNodeIds,List<ProcessFoodItemIngredientsVo> ingredients) {
        this.id = item.getId();
        this.name = item.getName();
        this.description = item.getDescription();
        this.image = item.getImage();
        this.categoryId = item.getCategoryId();
        this.price = SystemAmountUtil.pennyToYuan(item.getPrice());
        this.up = item.getUp();
        this.createTime = item.getCreateTime();
        this.categoryNodeIds = categoryNodeIds;
        this.ingredients = ingredients;
        this.units = item.getUnits();
        this.weight = item.getWeight();
    }
}
